﻿using System.Net.Http.Json;
using Compass.Wasm.Shared;
using Compass.Wasm.Shared.Plans;

namespace Compass.Wasm.Client.Services.Plans;

public interface IPackingListService:IBaseService<PackingListDto>
{
    Task<ApiResponse<PackingListDto>> GetPackingListDtoByMainPlanIdAsync(Guid mainPlanId);


}
public class PackingListService:BaseService<PackingListDto>,IPackingListService
{
    private readonly HttpClient _http;
    private const string ServiceName = "PackingList";
    public PackingListService(HttpClient http) : base(http, ServiceName)
    {
        _http = http;
    }
    public Task<ApiResponse<PackingListDto>> GetPackingListDtoByMainPlanIdAsync(Guid mainPlanId)
    {
        
        return _http.GetFromJsonAsync<ApiResponse<PackingListDto>>($"api/{ServiceName}/Maui/MainPlan/{mainPlanId}")!;
    }
}